import React,{useState,useEffect} from 'react'
import All from "../../../common/ebookTil/index"
import { getReadList } from "../../../../components/api"
import "../wujie/index.css"
import {NavLink,useParams} from "react-router-dom"
interface Re{
    introduc?: string,
    [propName:string]:any 
}
export default function Wujie() {
    const [Read, setRead] = useState<Re>({})
    const [c,setid]=useState<any>({})
    
    const getRead = async () => {
        let res= await getReadList()
        // console.log(res,"qw");
        setRead(res.data)
        setid(res.data.newList[0].content)
    }
    let newList = Read.newList
    // console.log(newList);
    let a = c.id
    // console.log(a,"id");
    
    useEffect(()=>{
        getRead()
    },[])
  return (
      <div>
          <All title={Read.introduce}></All>
          <NavLink to={"/detail/"+a}>
              <div> 
              <ul >
                  {
                      newList?.map((item:any,i:any) => <li
                      key={i} className="tianxia"
                      >
                          <img className='img' src={item.content.img}></img>
                          <span className='title'>{ item.content.title}</span>
                          <span className='time'>{ item.content.create_time}</span>
                    </li>)  
                  }
              </ul> 
          </div>
      </NavLink>

          
    </div>
  )
}
